<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>{{source_info}}和其他{{out_title}}间关联关系</title>
	<link href="/static/css/bootstrap.min.css" rel="stylesheet" /> 
	<script src="/static/js/jquery.min.js"></script> 
	<script src="/static/js/bootstrap.min.js"></script>     
</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div style = "margin: 0; font-size: 9px; text-align: right; color: #487858;">
    <a href="/version_node_net_{{source_download_info}}/">网状视图</a> |
    <a href="/version_node_csv_detail_{{source_download_info}}/">Download</a> 
    </div>
    <div class="row"> 
	    <div class="span12">
	    	<div id="main" style="height:600px"></div>
		</div> 
	<div class="span4" style="float: right;">
		<div class="tab-pane active" id="CM_Application_Maintainer"> <h4 id="-1">应用系统配置人员信息<a class="anchorjs-link " href="#-1" aria-label="Anchor link for:  1" data-anchorjs-icon="" style="font-family: anchorjs-icons; font-style: normal; font-variant: normal; font-weight: normal; line-height: 1; padding-left: 0.375em;"></a></h4><table class="table table-bordered table-striped"> <thead></thead><tbody><tr> <th scope="row">ID</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">2</span></td> </tr> <tr> <th scope="row">应用系统ID</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">2</span></td> </tr> <tr> <th scope="row">业务部门</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">开发部</span></td> </tr> <tr> <th scope="row">配置管理岗A</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">asds </span></td> </tr> <tr> <th scope="row">配置管理岗B</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">sad</span></td> </tr> <tr> <th scope="row">项目交付岗A</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">sad</span></td> </tr> <tr> <th scope="row">项目交付岗B</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">打撒</span></td> </tr> <tr> <th scope="row">项目经理</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">1111</span></td> </tr> <tr> <th scope="row">开发公司</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">111</span></td> </tr> <tr> <th scope="row">开发公司联系人</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">111</span></td> </tr> <tr> <th scope="row">第三方测试负责人</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">11</span></td> </tr> <tr> <th scope="row">第三方测试组长</th><td class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true">11</span></td> </tr> </tbody> </table></div>
	</div> 
	</div> 
	<link rel="stylesheet" href="{{ STATIC_URL }}css/jquery-ui.min.css">
	<script src="{{ STATIC_URL }}js/jquery.min.js"></script>
	<script src="{{ STATIC_URL }}js/jquery-ui.min.js"></script>
	<link rel="stylesheet" href="{{ STATIC_URL }}css/style.css">
    <!-- ECharts单文件引入 -->
    <script src="{{ STATIC_URL }}js/echarts.js"></script>

	<div id="dialog" title="{{out_title}}间交互">
	<p></p>
	</div>


    <script type="text/javascript">
        // 路径配置
		$(function() {
			$( "#dialog" ).dialog({
			  autoOpen: false,
			  show: {
				effect: "blind",
				duration: 1000
			  },
			  hide: {
				effect: "explode",
				duration: 1000
			  }
			 
			});
		  });
		
        require.config({
            paths: {
                echarts: '{{ STATIC_URL }}js/build/dist'
            }
        });
        
        // 使用
        require(
            [
                'echarts',
                'echarts/chart/force' // 使用力导向布局图就加载force模块，按需加载
            ],
            function (ec) {
                // 基于准备好的dom，初始化echarts图表
                var myChart = ec.init(document.getElementById('main')); 
		
        
        var option = {
    title : {
        text: '{{source_info}}和其他系统及版本间关联关系',
        subtext: '直接关系版',
        x:'right',
        y:'bottom'
    },
    tooltip : {
        trigger: 'item',
        formatter: ' {b}'
    },
    toolbox: {
        show : true,
        feature : {
            restore : {show: true},
            //magicType: {show: true, type: ['force', 'chord']},
            saveAsImage : {show: true}
        }
    },

    legend: {
        x: 'left',
        data:['主升级系统及版本','同步升级系统','需联测系统','其它']
    },
    series : [
        {
            type:'force',
            name : "{{out_title}}间数据流",
            ribbonType: false,
            
            categories : [
                {
                    name: '主升级系统及版本',
					 itemStyle: {
                        normal: {
                            color : '#ffff00'
                        }
                    }
					
                },
				
                {
                    name: '同步升级系统',
					itemStyle: {
                        normal: {
                            color : '#ff0000'
                        }
                    }
					
                },
				 {
                    name: '需联测系统',
					itemStyle: {
                        normal: {
                            color : '#ffaeb9'
                        }
                    }
                },
				 {
                    name: '其它',
					itemStyle: {
                        normal: {
                            color : '#6495ed'
                        }
                    }
                },
            ],
            itemStyle: {
                normal: {
                    label: {
                        show: true,
                        textStyle: {
                            color: '#333'
                        }
                    },
                    nodeStyle : {
                        brushType : 'both',
                        borderColor : 'rgba(255,215,0,0.4)',
                        borderWidth : 1
                    },
                    linkStyle: {
                        type: 'curve'
                    }
                },
                emphasis: {
                    label: {
                        show: false
                        // textStyle: null      // 默认使用全局文本样式，详见TEXTSTYLE
                    },
                    nodeStyle : {
                        //r: 30
                    },
                    linkStyle : {}
                }
            },
            useWorker: false,
            minRadius : 20,
            maxRadius : 45,
            gravity: 1.1,
            scaling: 1.1,
            roam: 'move',
            nodes:[
                {category:0, name: '{{source_info}}', value : 45, label: '{{source_info}}'},
	           	{% for target in target_need_sync %}
	            	{category:1, name: '{{ target }}', value : 25},
	            {% endfor %}              
	            {% for target in target_need_test %}
	            	{category:2, name: '{{ target }}', value : 15},
	            {% endfor %}     
   
	            {% for target in target_others %}
	            	{category:3, name: '{{ target }}', value : 10},
	            {% endfor %}                
            ],
           links : [
	            {% for target in target_need_sync %}
	            	{source : '{{source_info}}', target : '{{ target }}', weight : 6},
	            {% endfor %}
	            {% for target in target_need_test %}
	            	{source : '{{source_info}}', target : '{{ target }}', weight : 3},
	            {% endfor %}
	            {% for target in target_others %}
	            	{source : '{{source_info}}', target : '{{ target }}', weight : 1},
	            {% endfor %}	            	         
                
            ]
        }
    ]
};

        // 为echarts对象加载数据 
        myChart.setOption(option); 
		
		
var ecConfig = require('echarts/config');

var dialog_tabel_info = {
	{% for taget,s_t_info in source_target_info.items %}
		'{{source_info}} - {{taget}}':'{{s_t_info}}',
		
	{% endfor %}
}

function eConsole(param) {
	var lineName = param.name//辨别当前点中的边
	if (lineName.indexOf(" - ") >= 0 ){
		var s_t_info = dialog_tabel_info[lineName].split("	")
		
		var lineFrom = param.value.source;
		var lineTarget = param.value.target;
		document.getElementById('dialog').innerHTML = "<p>{{conf_node_info}}</p>"+
		"<p>传输依赖备注:"+s_t_info[3]+"</p>"+
		"<p>数据交互备注:"+s_t_info[4]+"</p>"+
		"<table border='1'>"+
		"<tr><th>"+lineFrom+"</th><th>"+lineTarget+"</th></tr>"+
		"<tr><td>本版本新增数据的流向</td><td>"+s_t_info[0]+"</td></tr>"+
		"<tr><td>关联系统是否联测</td><td>"+s_t_info[1]+"</td></tr>"+
		"<tr><td>关联系统是否升级</td><td>"+s_t_info[2]+"</td></tr></table>";
		$( "#dialog" ).dialog( "open" );
	}
	else{
		lineName = lineName.replace("\t","|")
		window.location.href='/version_node_detail_'+lineName+'/';
	}
}

		myChart.on(ecConfig.EVENT.CLICK, eConsole);
		myChart.on(ecConfig.EVENT.DBLCLICK, eConsole);
		//myChart.on(ecConfig.EVENT.HOVER, eConsole);
		myChart.on(ecConfig.EVENT.DATA_ZOOM, eConsole);
		myChart.on(ecConfig.EVENT.LEGEND_SELECTED, eConsole);
		myChart.on(ecConfig.EVENT.MAGIC_TYPE_CHANGED, eConsole);
		myChart.on(ecConfig.EVENT.DATA_VIEW_CHANGED, eConsole);

		
		}
		);
		
		
    </script>
    <div style = "margin: 0; font-size: 11px; text-align: right; color: #487858;">
		<a href="/upload_file/">| 文件上传</a> |
		<a href="/system_detail/">系统详情页</a> |
		<a href="/version_detail/">版本详情页</a> |
		<a href="/wiki_index/">系统百科页</a> |
		<a href="/dataex_detail/">交互信息展示页</a> |
		<a href="/cm_baseline/">基线展示页</a> |
		<a href="/cm_bi_index/">报表展示页</a> |
		<a href="/test_report_index/">测试周报页</a> |
	</div>
</body>